package cn.guanjia.action;

import javax.servlet.http.HttpServletRequest;
import javax.servlet.http.HttpServletResponse;

import org.apache.struts.action.Action;
import org.apache.struts.action.ActionForm;
import org.apache.struts.action.ActionForward;
import org.apache.struts.action.ActionMapping;

import cn.guanjia.formbean.ManagerBean;
import cn.guanjia.pojo.User;

/**
 * 管理员信息操作类
 * @author Administrator
 *
 */
public class ManagerAction extends Action{
	
	
	public ActionForward execute(ActionMapping mapping, ActionForm form,
			HttpServletRequest request, HttpServletResponse response)
			throws Exception {
		System.out.println("start");
		
		ManagerBean mb = (ManagerBean)form;
		
		System.out.println(mb.getManagerName()+"     "+mb.getManagerPwd());
		
		//新建一个管理员对象
		User user = new User();
		user.setUserName(mb.getManagerName());
		user.setUserPwd(mb.getManagerPwd());
		
		//操作数据库，添加一个管理员对象
		boolean result = cn.guanjia.dao.UserDao.addManagerInfo(user);
		
		System.out.println(result);
		
		
		return null;
		
	}

}
